package com.gxa.jjty.admin.controller;

import com.gxa.jjty.admin.service.AreaService;
import com.gxa.jjty.core.common.JsonResult;
import com.gxa.jjty.core.pojo.Area;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @ClassName AreaController
 * @Author: ws
 * @date 2021/12/3 14:18
 */
@RestController
@RequestMapping("/area")
@Api(tags = "区域的接口")
public class AreaController {

    @Autowired
    private AreaService areaService;

    @GetMapping("/getAll")
    @ApiOperation("查询所有区域信息")
    public Map getAll(){

        List<Area> areas = areaService.selectAll();

        JsonResult jsonResult = new JsonResult();
        jsonResult.setCode("1");
        jsonResult.setData(areas);

        return jsonResult.getDataMap();
    }

}
